<?php

namespace app\api\controller\answers;
use app\api\service\answers\SiderGptService;
use think\facade\Request;

class SiderGpt
{

    protected $Service;
    public function __construct()
    {
        $this->Service = SiderGptService::getInstance();
    }

    public function gpt(){
        $params = Request::post();
        $result = $this->Service->gpt($params);
        return writeJson(200,$result);

    }


    public function merge(){
        $params = Request::post();
        $image_template = $params['img1']; # 主图
        $image_target = $params['img2']; # 融合人物图
        $result = $this->Service->merge($image_template,$image_target);
        return writeJson(200,$result);
    }


    public function  writingpng(){
        $params = Request::post();
        $text_arr = $params['text_arr']; # 文案数组
        $color = $params['color']??"white"; # 字体颜色
        $result = $this->Service->writingpng($text_arr,$color);
        return writeJson(200,$result);
    }
}
